/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.pp.entites;

import java.io.Serializable;
import java.util.Date;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author arnaud
 */
@Entity
@Table(name = "tube")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Tube.findAll", query = "SELECT t FROM Tube t"),
    @NamedQuery(name = "Tube.findById", query = "SELECT t FROM Tube t WHERE t.id = :id"),
    @NamedQuery(name = "Tube.findByLongueur", query = "SELECT t FROM Tube t WHERE t.longueur = :longueur"),
    @NamedQuery(name = "Tube.findByDiametre", query = "SELECT t FROM Tube t WHERE t.diametre = :diametre"),
    @NamedQuery(name = "Tube.findByFiletage", query = "SELECT t FROM Tube t WHERE t.filetage = :filetage"),
    @NamedQuery(name = "Tube.findByPoidsLineaire", query = "SELECT t FROM Tube t WHERE t.poidsLineaire = :poidsLineaire"),
    @NamedQuery(name = "Tube.findByLot", query = "SELECT t FROM Tube t WHERE t.lot = :lot"),
    @NamedQuery(name = "Tube.findByTimestampCreation", query = "SELECT t FROM Tube t WHERE t.timestampCreation = :timestampCreation"),
    @NamedQuery(name = "Tube.findByCoulee", query = "SELECT t FROM Tube t WHERE t.coulee = :coulee"),
    @NamedQuery(name = "Tube.findByUsine", query = "SELECT t FROM Tube t WHERE t.usine = :usine"),
    @NamedQuery(name = "Tube.findByBurst", query = "SELECT t FROM Tube t WHERE t.burst = :burst"),
    @NamedQuery(name = "Tube.findByCollapse", query = "SELECT t FROM Tube t WHERE t.collapse = :collapse"),
    @NamedQuery(name = "Tube.findByTension", query = "SELECT t FROM Tube t WHERE t.tension = :tension"),
    @NamedQuery(name = "Tube.findByEpaisseur", query = "SELECT t FROM Tube t WHERE t.epaisseur = :epaisseur"),
    @NamedQuery(name = "Tube.findByNbControles", query = "SELECT t FROM Tube t WHERE t.nbControles = :nbControles")})
public class Tube implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "id")
    private Long id;
    // @Max(value=?)  @Min(value=?)//if you know range of your decimal fields consider using these annotations to enforce field validation
    @Column(name = "longueur")
    private Float longueur;
    @Column(name = "diametre")
    private String diametre;
    @Column(name = "filetage")
    private String filetage;
    @Column(name = "poidsLineaire")
    private Float poidsLineaire;
    @Column(name = "lot")
    private String lot;
    @Column(name = "timestamp_creation")
    @Temporal(TemporalType.TIMESTAMP)
    private Date timestampCreation;
    @Column(name = "coulee")
    private String coulee;
    @Column(name = "usine")
    private String usine;
    @Column(name = "burst")
    private Integer burst;
    @Column(name = "collapse")
    private Integer collapse;
    @Column(name = "tension")
    private Float tension;
    @Column(name = "epaisseur")
    private Float epaisseur;
    @Column(name = "nbControles")
    private Integer nbControles;
    @JoinTable(name = "tube_has_traitement", joinColumns = {
        @JoinColumn(name = "idtube", referencedColumnName = "id")}, inverseJoinColumns = {
        @JoinColumn(name = "idtraitement", referencedColumnName = "id")})
    @ManyToMany
    private List<Traitement> traitementList;
    @JoinColumn(name = "idrack", referencedColumnName = "id")
    @ManyToOne
    private Rack idrack;

    public Tube() {
    }

    public Tube(Long id) {
        this.id = id;
    }

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public Float getLongueur() {
        return longueur;
    }

    public void setLongueur(Float longueur) {
        this.longueur = longueur;
    }

    public String getDiametre() {
        return diametre;
    }

    public void setDiametre(String diametre) {
        this.diametre = diametre;
    }

    public String getFiletage() {
        return filetage;
    }

    public void setFiletage(String filetage) {
        this.filetage = filetage;
    }

    public Float getPoidsLineaire() {
        return poidsLineaire;
    }

    public void setPoidsLineaire(Float poidsLineaire) {
        this.poidsLineaire = poidsLineaire;
    }

    public String getLot() {
        return lot;
    }

    public void setLot(String lot) {
        this.lot = lot;
    }

    public Date getTimestampCreation() {
        return timestampCreation;
    }

    public void setTimestampCreation(Date timestampCreation) {
        this.timestampCreation = timestampCreation;
    }

    public String getCoulee() {
        return coulee;
    }

    public void setCoulee(String coulee) {
        this.coulee = coulee;
    }

    public String getUsine() {
        return usine;
    }

    public void setUsine(String usine) {
        this.usine = usine;
    }

    public Integer getBurst() {
        return burst;
    }

    public void setBurst(Integer burst) {
        this.burst = burst;
    }

    public Integer getCollapse() {
        return collapse;
    }

    public void setCollapse(Integer collapse) {
        this.collapse = collapse;
    }

    public Float getTension() {
        return tension;
    }

    public void setTension(Float tension) {
        this.tension = tension;
    }

    public Float getEpaisseur() {
        return epaisseur;
    }

    public void setEpaisseur(Float epaisseur) {
        this.epaisseur = epaisseur;
    }

    public Integer getNbControles() {
        return nbControles;
    }

    public void setNbControles(Integer nbControles) {
        this.nbControles = nbControles;
    }

    @XmlTransient
    public List<Traitement> getTraitementList() {
        return traitementList;
    }

    public void setTraitementList(List<Traitement> traitementList) {
        this.traitementList = traitementList;
    }

    public Rack getIdrack() {
        return idrack;
    }

    public void setIdrack(Rack idrack) {
        this.idrack = idrack;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Tube)) {
            return false;
        }
        Tube other = (Tube) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.pp.entites.Tube[ id=" + id + " ]";
    }
    
}
